<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="java.util.*" %>
<%@ page import="java.io.*" %>
<%@ page import="jxl.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>修改个人信息</title>
<link rel="stylesheet" type="text/css" href="/purpose-for-stu/css/base.css">
<link rel="stylesheet" href="/purpose-for-stu/css/jquery-ui-1.8.13.custom.css">
<script type="text/javascript" src="/purpose-for-stu/js/jquery/jquery-1.5.1.min.js"></script>
<script type="text/javascript" src="/purpose-for-stu/js/jquery/jquery-ui-1.8.13.custom.min.js"></script>
<script type="text/javascript" src="/purpose-for-stu/js/jquery/jquery.ui.datepicker.js"></script>
<style type="text/css">
		body,td,th {
			font-size: 14px;
		}
	</style>
<script type="text/javascript">
	$(function() {
		$("#datepicker").datepicker({
			changeMonth: true,
			changeYear: true
		});
	});
	//判定输入内容是否为空 
	function check(){
		if(document.stuform.stuName.value.trim()==""){
			alert("姓名没有填写!");
			document.stuform.stuId.focus();
			return false;
		}	
		if(document.stuform.birth.value.trim()==""){
			alert("出生日期没有填写!");
			document.stuform.stuId.focus();
			return false;
		}
	}
</script>
</head>
<body>

<%

String stuid = request.getParameter("stuid").trim();  /*将 stuid 的值传递过来，并赋值给stuid */
String []array;
array = new String[5];
int row=0;
String stid=null;
try
{
	File fileName = new File("D:/workplace/stuinfo.xls");
	Workbook book = Workbook.getWorkbook(fileName);	
	Sheet sheet=book.getSheet(0); 		/*获得第一个工作表对象*/	
	int rows = sheet.getRows();			/*得到总行数*/
	for(row = 1; row<rows;row++)
	{
		Cell cell = sheet.getCell(0, row);
		String str = cell.getContents();
		
		//取得对应行的各项信息，并存入数组array中 
		if(str.equals(stuid))
		{
			stid = str;
			array[0] = str;
			Cell cell1 = sheet.getCell(1, row);
			array[1] = cell1.getContents();
			Cell cell2 = sheet.getCell(2, row);
			array[2] = cell2.getContents();
			Cell cell3 = sheet.getCell(3, row);
			array[3] = cell3.getContents();
			Cell cell4 = sheet.getCell(4, row);
			array[4] = cell4.getContents();					
		}
	}
	book.close();
}catch(Exception e)
{
	System.out.println(e);
}
%>

<div id="container">
	<div id="top">
		<!--Logo start -->
			<div id="logo"></div>
			<div id="info"> 
				<a href="stumaininfo.jsp?stuid=<%= stuid%>">返回个人信息首页</a>
			</div>
		<!--logo end -->
	</div>
	
	<div id="content">
	  	<div id="stucontent">	
	  		<form name="stuform" action="stumodifyinfop.jsp?stuid=<%= stuid%>" method="post" onSubmit="return check();"><table border="1" align="center">
	  		<tr><td width="90" align="center" height="35">信息</td><td width="160" align="center">修改前</td><td width="170" align="center">请输入数据</td></tr>
			<tr><td align="center">学号：</td><td height="25" align="center"><%= array[0]%></td><td  align="center"><%= array[0]%></td></tr>
			<tr><td align="center">姓名：</td><td height="20" align="center"><%= array[1]%></td><td align="left"><input type="text" name="stuName" /><font color="red">*</font></td></tr>
			<tr><td align="center">出生日期：</td><td height="20" align="center"><%= array[2]%></td><td align="left"><input type="text" name="birth" id="datepicker" /><font color="red">*</font></td></tr>
			<tr><td align="center">联系电话：</td><td height="20" align="center"><%= array[3]%></td><td align="left"><input type="text" name="stuTele" /></td></tr>
			<tr><td align="center">QQ号码：</td><td height="20" align="center"><%= array[4]%></td><td align="left"><input type="text" name="stuQQ" /></td></tr>
			<tr><td align="center"></td><td align="center"></td><td align="center"><input type="submit" value="提 交" /><input type="reset" value="重 置" /></td></tr>
			</table></form>	
		</div>
	</div>
	<div id="footer">@copyright</div>
</div>

</body>
</html>